package com.apci.ipreda.client.web.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.handler.SimpleMappingExceptionResolver;

public class GeneralExceptionResolver extends SimpleMappingExceptionResolver {
	
	
	public ModelAndView resolveException(HttpServletRequest request, HttpServletResponse response, Object arg2, Exception exception) {

		String error = (String)request.getParameter("error");
		request.setAttribute("error", error);
		
		logger.info("=============================\n"+ exception.getMessage());
		logger.fatal("An UNEXPECTED error just occurred", exception);

		return super.resolveException(request, response, arg2, exception);
	}
}
